home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: MegaDisc / MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 2 of 2).zip / MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 2 of 2).adf / Programming / Basic_Tutorial_8 / NewpicShow.bas < prev    next >
BASIC Source File  |  1992-03-30  |  2KB  |  115 lines

  1.  
  2.   LIBRARY "arp.library"
  3.   DECLARE FUNCTION FileRequest& LIBRARY
  4.   DECLARE FUNCTION xOpen& LIBRARY
  5.   DECLARE FUNCTION Execute& LIBRARY
  6.   DIM req&(7)
  7.  
  8. MENU 2,0,0,""
  9. MENU 3,0,0,""
  10. MENU 4,0,0,""
  11. MENU 1,0,1,"Program"
  12. MENU 1,1,1,"New-Cli      "
  13. MENU 1,2,1,"Show Picture "
  14. MENU 1,3,1,"Quit         "
  15.  
  16. Init:
  17.   SCREEN 1,640,256,3,2
  18.   WINDOW 2,,,0,1
  19. FOR q = 0 TO 7
  20. READ r,g,b
  21. PALETTE q,r/16,g/16,b/16
  22. NEXT q
  23. RESTORE
  24. DATA 0,0,0, 0,0,15, 15,0,0, 0,15,0, 14,7,0, 0,4,10, 8,0,15, 7,7,7
  25. Start:
  26. LOCATE 15,15
  27. PRINT "Press Right Mouse Button for Menus"
  28.  
  29. ON MENU GOSUB MSel
  30. MENU ON
  31. MainLoop:
  32. WHILE -1
  33. WEND
  34. GOTO Endit
  35. MSel:
  36. Men=MENU(0)
  37. Sel=MENU(1)
  38. ON Men GOTO Prog
  39. Prog:
  40.  
  41. ON Sel GOTO Bascli,Direct,Endit
  42.  
  43. Bascli:
  44. PRINT CHR$(12)
  45. PRINT:PRINT
  46. PRINT "PLEASE ENTER THE PATH TO THE PROGRAM YOU WISH TO RUN"
  47. INPUT "1>";comm$
  48. OUT$="RAM:CLI_out"+CHR$(0)
  49.  
  50. comm$=comm$+CHR$(0)
  51. connect&=xOpen&(SADD(OUT$),1006)
  52. ex&=Execute&(SADD(comm$),0,connect&)
  53. xClose(connect&)
  54.  
  55. bline=1
  56. PRINT CHR$(12)
  57. OPEN "I",#1,"RAM:CLI_out"
  58. WHILE NOT EOF(1)
  59. LINE INPUT #1,inf$
  60. PRINT inf$
  61. bline=bline+1
  62. IF CSRLIN=24 THEN
  63. INPUT "Press any key to continue",dum$
  64. PRINT CHR$(12)
  65. END IF
  66. WEND
  67. CLOSE #1
  68. INPUT "Press any key to continue ",dum$
  69. PRINT CHR$(12)
  70. GOTO Start
  71.  
  72. Direct:
  73.   title$="Show a picture file"
  74.   dir$="Megadisc27A:Art_Gallery"       '""=current directory, or you may specify one
  75.   file$=""      'this could be set to a default value if you like
  76.  
  77. dloop:
  78.   requester title$,dir$,file$,colr
  79.   IF file$="" THEN
  80.     PRINT "No file selected!":GOTO Start
  81.   ELSE
  82.     IF RIGHT$(dir$,1)<>":" AND dir$>"" THEN dir$=dir$+ "/"
  83.     comm$="SYS:c/FullView "+dir$+file$+" +p"
  84.   END IF
  85.  
  86. OUT$="RAM:CLI_out"+CHR$(0)
  87. comm$=comm$+CHR$(0)
  88. connect&=xOpen&(SADD(OUT$),1006)
  89. ex&=Execute&(SADD(comm$),0,connect&)
  90. xClose(connect&)
  91. dir$="DH0:pics":file$=""
  92. GOTO dloop
  93.  
  94. Endit:
  95.   LIBRARY CLOSE
  96.   WINDOW CLOSE 2
  97.   SCREEN CLOSE 1
  98.   SYSTEM
  99.  
  100. SUB requester(title$,dir$,file$,colr) STATIC
  101.   SHARED req&()
  102.   title$=title$+CHR$(0)
  103.   dir$=dir$+STRING$(354,0)
  104.   file$=file$+STRING$(32,0)
  105.   req&(0)=SADD(title$)
  106.   req&(1)=SADD(file$)
  107.   req&(2)=SADD(dir$)
  108.   req&(3)=WINDOW(7)
  109.   req&(4)=2^28-2^29*(colr=1)
  110.   temp&=FileRequest&(VARPTR(req&(0)))
  111.   IF temp&=0 THEN file$=CHR$(0)
  112.   dir$=LEFT$(dir$,INSTR(dir$,CHR$(0))-1)
  113.   file$=LEFT$(file$,INSTR(file$,CHR$(0))-1)
  114. END SUB
  115.